(function (lib, config) {
    var loadFunc = function () {
        var textAry = config.words.split('|'), bgcolorAry = config.bgcolor.split('|'), textcolorAry = config.textcolor.split('|'), imglinkAry = config.imglink.split('|'), weblinkAry = config.weblink.split('|'), identiAry = config.identifier.split('|');
        textAry[0] = textAry[0] || '华都医院值班医生';
        textAry[1] = textAry[1] || '您好！我已经在线等待';
        textAry[2] = textAry[2] || '免费为您解决疑问，请点击回复';
        textAry[3] = textAry[3] || '12';
        textAry[4] = textAry[4] || '立即预约';
        textAry[5] = textAry[5] || '电话预约';

        textcolorAry[0] = textcolorAry[0] || '#ffffff';
        textcolorAry[1] = textcolorAry[1] || '#ffffff';
        textcolorAry[2] = textcolorAry[2] || '#fff45c';
        textcolorAry[3] = textcolorAry[3] || '#fff45c';
        textcolorAry[4] = textcolorAry[4] || '#fff45c';
        textcolorAry[5] = textcolorAry[5] || '#fff45c';

        bgcolorAry[0] = bgcolorAry[0] || '#df3c85';
        bgcolorAry[1] = bgcolorAry[1] || '#ffffff';
        bgcolorAry[2] = bgcolorAry[2] || '#fff45c';
        bgcolorAry[3] = bgcolorAry[3] || '#fff45c';

        imglinkAry[0] = imglinkAry[0] || 'http://m.hdyy.com.cn/swt/img20161206/bottom_zj.jpg';
        weblinkAry[0] = weblinkAry[0] || 'tel:029-62513333';
        identiAry[0] = identiAry[0] || '"dibu_yuan"';
        config.width = 100, config.height = 100;
        var htmlStr = [];
        htmlStr.push("<style type=\'text/css\'> ");/*bottom:4rem;right: 1%;*/
        htmlStr.push(".black_overlay {display: none;position: absolute;top: 0%;left: 0%;width: 100%;height: 100%;background-color: black;z-index: 999991001;-moz-opacity: 0.8;opacity: .80;filter: alpha(opacity=80);}");
        htmlStr.push(".white_content {width: 100px;height: 100px;display: none;position: fixed;"+lib.util.getPosStyle(config)+";border: 1px solid orange;border-radius: 50px;z-index: 999991002;font-size: 13px;line-height: 14px;overflow: hidden;background: " + bgcolorAry[0] + ";pointer-events: auto;}");
        htmlStr.push(".white_Close {bottom:4rem;right: 5px;position: fixed;z-index: 999991003;display: none;margin-bottom:100px;pointer-events: auto;}");
        htmlStr.push(".white_yy {width: 100%;height: 100%;}");
        htmlStr.push(".white_yyimg {float: left;width: 90px;height: 90px;border-radius: 100%;overflow: hidden;margin: 5px 0 0 5px;}");
        htmlStr.push(".white_title {float: left;width: 60%;height: 30px;margin-left: 10px;display: inline;line-height: 30px;color:" +textcolorAry[0]+ ";font-size: 16px;font-weight: bold;}");
        htmlStr.push(".white_p {float: left;width: 65%;height: 40px;margin:-5px 0 5px 10px;line-height:20px;font-size:12px;color: " + textcolorAry[1] + ";overflow:visible;}");
        htmlStr.push(".white_p span{color:"+ textcolorAry[3] + ";font-weight:block;font-size:16px;}");
        htmlStr.push(".white_an {float: left;width: 65%;height: 20px;margin-left: 10px;display: inline;overflow:visible;}");
        htmlStr.push(".white_an a{display:block;margin-right:4px;float:left;width:77px;height:24px;line-height:24px;text-align:center;border-radius:5px;color:" +textcolorAry[4] + ";background:" + bgcolorAry[1] + ";text-decoration:none;}");
        htmlStr.push(".white_an a:nth-child(2){background:" + bgcolorAry[2] + ";}");
        htmlStr.push(".white_m {margin-left: 20px;line-height: 65px;font-size:36px;color:" + '#fff100' + ";}");
        htmlStr.push(".white_zx {width:100%;height:35px;line-height:30px;text-align: center;font-weight: bold;background-color:" + bgcolorAry[3] + ";color:" + '#e7453a' + ";}");
        htmlStr.push("@-webkit-keyframes shake-little { 0, 20% {");
        htmlStr.push(" -webkit-transform: translate(0px, 0px) rotate(0deg)");
        htmlStr.push("}");
        htmlStr.push("21% {");
        htmlStr.push(" -webkit-transform: translate(0px, 0px) rotate(0deg)");
        htmlStr.push("}");
        htmlStr.push("21.3% {");
        htmlStr.push(" -webkit-transform: translate(-2px, 2px) rotate(0.5deg)");
        htmlStr.push("}");
        htmlStr.push("21.6% {");
        htmlStr.push(" -webkit-transform: translate(0px, 0px) rotate(0deg)");
        htmlStr.push("}");
        htmlStr.push("22% {");
        htmlStr.push(" -webkit-transform: translate(2px, -2px) rotate(-0.5deg)");
        htmlStr.push("}");
        htmlStr.push("22.3% {");
        htmlStr.push(" -webkit-transform: translate(0px, 0px) rotate(0deg)");
        htmlStr.push("}");
        htmlStr.push("22.6% {");
        htmlStr.push(" -webkit-transform: translate(-2px, 2px) rotate(0.5deg)");
        htmlStr.push("}");
        htmlStr.push("23% {");
        htmlStr.push(" -webkit-transform: translate(0px, 0px) rotate(0deg)");
        htmlStr.push("}");
        htmlStr.push("23.3% {");
        htmlStr.push(" -webkit-transform: translate(2px, -2px) rotate(-0.5deg)");
        htmlStr.push("}");
        htmlStr.push("23.6% {");
        htmlStr.push(" -webkit-transform: translate(0px, 0px) rotate(0deg)");
        htmlStr.push("}");
        htmlStr.push("24% {");
        htmlStr.push(" -webkit-transform: translate(2px, -2px) rotate(-0.5deg)");
        htmlStr.push("}");
        htmlStr.push("24.3%, 100% {");
        htmlStr.push(" -webkit-transform: translate(0px, 0px) rotate(0deg)");
        htmlStr.push("}");
        htmlStr.push("}");
        htmlStr.push("</style> ");
        htmlStr.push("<div id=\'light\' class=\'white_content\'> ");
        htmlStr.push("   <span id=\'txt\'></span>");
        htmlStr.push("</div>");
        htmlStr.push("<a href=\'javascript:void(0)\' onClick=\'white_Close()\' class=\'white_Close\' id=\'fade\'><img src=\'http://m.hdyy.com.cn/swt/img20161206/close.gif\'></a>");
        var o = document.createElement('div');
        o.innerHTML = htmlStr.join('');
        while (o.firstElementChild) {
            document.body.appendChild(o.firstElementChild);
        };
        //底部倒计时
        var c = +textAry[3];
        var t;
        var str;

        function timeCount() {
            str = "<div class=\"white_yy\"><div class=\"white_yyimg\" onClick=\"openZoosUrl('" + identiAry[0] + "');\"><img src=\"" + imglinkAry[0] + "\"><\/div><div class=\"white_title\" onClick=\"openZoosUrl('" + identiAry[0] + "');\">" + textAry[0] + "<\/div><div class=\"white_p\" onClick=\"openZoosUrl('" + identiAry[0] + "');\">" + textAry[1] + "<span>" + c + "</span>秒，<br\/><span style='color:"+textcolorAry[2]+";'>" + textAry[2] + "</span><\/div><div class=\"white_an\"><a href=\"javascript:void(0);\" onClick=\"openZoosUrl('" + identiAry[0] + "');\">"+textAry[4]+"<\/a><a href=\"" + weblinkAry[0] + "\" style='color:"+textcolorAry[5]+";'>"+textAry[5]+"<\/a><\/div><\/div>";
            document.getElementById('txt').innerHTML = str;
            c = c + 1;
            t = setTimeout(timeCount, 1000);
            if (c > 30) {
                c = textAry[3];
                clearTimeout(t);
                setTimeout(timedCount, 1);
                document.getElementById('light').style.width = '100px'
            }
        }

        function timedCount() {
            str = "<div class=\"white_yy\" onClick=\"openZoosUrl('" + identiAry[0] + "');\"><span class=\"white_m\">" + c + "</span><font color=\"#fff\">秒后<\/font><div class=\"white_zx\">在线咨询<\/div><\/div>";
            document.getElementById('txt').innerHTML = str;
            c = c - 1;
            t = setTimeout(timedCount, 1000);
            if (c < 0) {
                c = 1;
                clearTimeout(t);
                setTimeout(timeCount, 1);
                document.getElementById('light').style.transition = "width 0.5s";
                document.getElementById('light').style.width = '96%'
            }
        }

        function white_content() {
            document.getElementById('light').style.display = 'block';
            document.getElementById('light').style.width = '100px';
            document.getElementById('fade').style.display = 'block';
            return timedCount()
        }

        white_Close = function () {
            document.getElementById('light').style.display = 'none';
            document.getElementById('fade').style.display = 'none';
            clearTimeout(t);
            c = textAry[3];
            setTimeout(white_content, config.relapsetime * 1000)
        }
        setTimeout(white_content, config.firsttime * 1000);
    };
    lib.load(loadFunc);
})('{{lib}}', '{{config}}');